package com.untour.im.codec.protocol.message.content;

import com.untour.im.codec.constants.MessageCententTypeEnum;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;

@Setter
@Getter
@NoArgsConstructor
public class ImMessageContent<T extends MessageContent> {
    /**
     * 消息类型
     *
     * @see MessageCententTypeEnum
     */
    private int mcType;

    /**
     * 消息内容
     */
    private T content;


    public ImMessageContent(T content) {
        this.content = content;
        if (content instanceof TxtMessageContent) {
            this.mcType = MessageCententTypeEnum.TXT.getValue();
        } else if (content instanceof ImMessageContent) {
            this.mcType = MessageCententTypeEnum.IMAGE.getValue();
        } else if (content instanceof EmojiMessageContent) {
            this.mcType = MessageCententTypeEnum.EMOJI.getValue();
        } else{
            this.mcType = MessageCententTypeEnum.COMBINATION.getValue();
        }
    }
}
